package javawdw.io.simple;

import java.io.OutputStream;

import javawdw.io.BinaryWriter;
import javawdw.io.TextWriter;

/**
 * 文件写入器工厂类
 * 
 * @author David
 * 
 */
public class WriterFactory {
	/**
	 * 获取文本类输出流TextWriter对象, 支持绝对路径和相对路径参数
	 * 
	 * @param outputStream
	 *            输出流
	 * @param charsetName
	 *            字符集字符串表示形式
	 * @return 返回TextWriter对象
	 */
	public static TextWriter openTextWriter(OutputStream outputStream,
			String charsetName) {
		return new BufferedTextWriter(outputStream, charsetName);
	}

	/**
	 * 根据默认字符集获取文本类输出流TextWriter对象, 支持绝对路径和相对路径参数
	 * 
	 * @param outputStream
	 *            输出流
	 * @return 返回TextWriter对象
	 */
	public static TextWriter openTextWriter(OutputStream outputStream) {
		return new BufferedTextWriter(outputStream);
	}

	/**
	 * 根据给定文件获得二进制输出写入器
	 * 
	 * @param outputStream
	 *            输出流
	 * @return 返回写入器
	 */
	public static BinaryWriter openBinaryWriter(OutputStream outputStream) {
		return new BufferedBinaryWriter(outputStream);
	}
}